#include "stdafx.h"

BStrategyMgr::~BStrategyMgr()
{
	for (std::pair<std::wstring, BulletStrategy *> s : bsmap)
	{
		delete s.second;
	}
}

BStrategyMgr * BStrategyMgr::getInstance()
{
	static BStrategyMgr manager;

	return &manager;
}

BulletStrategy * BStrategyMgr::get(const std::wstring & name)
{
	if (bsmap.count(name) == 0)
	{
		if (name == L"Linear")
		{
			bsmap[name] = new LinearBulletStrategy();
		}
		else if (name == L"Track")
		{
			bsmap[name] = new TrackBulletStrategy();
		}
	}

	return bsmap[name];
}


EStrategyMgr::~EStrategyMgr()
{
	for (std::pair<std::wstring, EnemyStrategy *> s : esmap)
	{
		delete s.second;
	}
}

EStrategyMgr * EStrategyMgr::getInstance()
{
	static EStrategyMgr manager;

	return &manager;
}

EnemyStrategy * EStrategyMgr::get(const std::wstring & name)
{
	if (esmap.count(name) == 0)
	{
		if (name == L"Linear")
		{
			esmap[name] = new EnemyStrategyLinear();
		}
		else if (name == L"Static")
		{
			esmap[name] = new EnemyStrategyStatic();
		}
	}

	return esmap[name];
}

GameStrategyMgr::~GameStrategyMgr()
{
	for (std::pair<std::wstring, GameStrategy *> s : gsmap)
	{
		delete s.second;
	}
}

GameStrategyMgr * GameStrategyMgr::getInstance()
{
	static GameStrategyMgr manager;

	return &manager;
}

GameStrategy * GameStrategyMgr::get(const std::wstring & gname)
{
	if (gsmap.count(gname) == 0)
	{
		if (gname == L"KillAll")
		{
			gsmap[gname] = new GameKillAll();
		}
		else if (gname == L"EndPoint")
		{
			gsmap[gname] = new GameEndPoint();
		}
		else if (gname == L"Collection")
		{
			gsmap[gname] = new GameCollection();
		}
	}

	return gsmap[gname];
}